package com.carlwang.web.comtroller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.carlwang.pojo.Profile;
import com.carlwang.pojo.TaskList;
import com.carlwang.service.imp.TaskDaoServiceImp;

@Controller
public class GetListsController {
	private TaskDaoServiceImp mService;
	private static final String PROFILE = "profile";

	@RequestMapping(value = "taskList")
	public ModelAndView getPlayListByUser(ModelAndView pModelAndView,
			HttpServletRequest pReq) {
		Profile profile = (Profile) pReq.getSession().getAttribute(PROFILE);
		List<TaskList> taskList = (List<TaskList>) mService
				.loadByUser(profile);
		pModelAndView.addObject("taskList", taskList);
		pModelAndView.setViewName("list");
		return pModelAndView;

	}

	public TaskDaoServiceImp getService() {
		return mService;
	}

	public void setService(TaskDaoServiceImp service) {
		mService = service;
	}
}
